/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Module Name          : com.yaodian100.ec.category.web.CategoryAction
   Module Description   :

   Date Created      : 2009/11/5
   Original Author   : ellen.li
   Team              : yaodian100
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   MODIFICATION HISTORY
   ------------------------------------------------------------------------------
   Date Modified       Modified by       Comments
   ------------------------------------------------------------------------------
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
package com.yaodian100.ec.category.web;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.xwork.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import com.yaodian100.core.admin.entity.Group;
import com.yaodian100.core.admin.entity.User;
import com.yaodian100.core.admin.service.GroupService;
import com.yaodian100.core.admin.service.UserService;
import com.yaodian100.core.admin.utils.AdminHelper;
import com.yaodian100.core.common.dao.impl.CommonCriteria;
import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.core.common.service.DomainService;
import com.yaodian100.core.menu.entity.Menu;
import com.yaodian100.core.menu.entity.Option;
import com.yaodian100.ec.category.entity.Category;
import com.yaodian100.ec.category.service.CategoryService;
import com.yaodian100.ec.common.EcConstant;

/**
 * @author ellen.li
 * 
 */
// public class CategoryAction extends ActionSupport implements Preparable {
public class CategoryAction extends ActionSupport implements Preparable {
	private static final long serialVersionUID = -8854158150237636139L;
	/** logger */
	private final Logger logger = LoggerFactory.getLogger(CategoryAction.class);
	private CategoryService categoryService;
	private DomainService<Menu> menuService;
	private List<Category> categories;
	private List<Category> categoryRoot;
	private Category category;
	private Category parent;
	private String id;
	private String name;
	private String jsons;
	private String categoryid;
	private String editname;
	private String editaliasname;
	private String edittemplateid;
	private String editstartdate;
	private String editenddate;
	private String editshowseq;
	private String editispromotion;
	private String editisbrand;
	private String editishighlight;
	private String editisvisible;
	private String editorgnizationpath;
	private String editpmID;
	private String newcategory;
	private String editlevel;
	private String editIsEndNode;
	private Menu menu;
	private String initlevel;
	private String flag;
	private String timestart;
	private String timeend;
	private String parentName;
	private String changeEndnodeMsg;
	private String endNodeId;
	private final String pmGroupCode = "A-20";
	private Map<String, Group> groupsMap = new HashMap<String, Group>();
	private String editisdelete = "N";
	private List<Group> groups;
	private String editGrossProfit;

	/* 搜寻用参数 */
	private String visibleParam = "Y";
	private String deleteParam = "N";

	@Autowired
	private GroupService groupService;
	@Autowired
	private UserService userService;

	public String checkJson() throws CoreException {

		if (getCategoryid() != null && !"null".equals(getCategoryid())) {
			StringBuffer sb = new StringBuffer();
			sb.append("[");
			List<Category> categories = categoryService.getChild(Long.parseLong(getCategoryid()));
			for (Category ctry : categories) {
				sb.append("\"");
				sb.append(ctry.getId() + ":" + ctry.getName());
				sb.append("\"");
				sb.append(",");
			}
			sb.append("]");
			setJsons(sb.toString());
		}
		return "auto";
	}

	public String checkJsonData() throws CoreException {
		StringBuffer sb = new StringBuffer();
		if (!categoryid.equals("null")) {
			if (getCategoryid() != null && !"null".equals(getCategoryid())) {
				if (!getCategoryid().subSequence(0, 1).equals("x")) {
					sb.append("[");
					List<Category> categories = categoryService.getChild(Long.parseLong(getCategoryid()));
					if (categories.size() > 0) {
						for (Category ctry : categories) {
							sb.append("\"");
							sb.append(ctry.getId() + ":" + ctry.getName() + ":" + ctry.getIsBrand() + ":" + ctry.getIsPromotion()
									+ ":" + ctry.getIsVisible());
							sb.append("\"");
							sb.append(",");
						}
						sb.append("\"x").append(categories.get(0).getParentId()).append(":===新增分類===\"");
					} else {
						if (!categoryService.getCategoryById(Long.parseLong(getCategoryid())).getParentId().toString().equals("11")) {
							sb.append("\"x").append(getCategoryid()).append(":===新增子分類===\"");
						}
					}
					sb.append("]");
					setJsons(sb.toString());
				} else {
					setJsons("");
				}
			}
		}
		return "arraydata";
	}

	public String editdata() throws NumberFormatException, CoreException {
		User user = AdminHelper.getUser();
		if (id.subSequence(0, 1).equals("x")) {
			editorgnizationpath = user.getGroupName();
			setNewcategory(id.substring(1));
			parent = categoryService.get(Long.parseLong(id.substring(1)));
			setParentName(parent.getName());// 取得父類別名稱
		} else {
			category = categoryService.get(Long.parseLong(id));
			setNewcategory("");
			if (null == category) {
				addActionError("查无分类资料(或无该权限查看)");
				return "editdata";
			}
			parent = categoryService.get(category.getParentId());
			setParentName(parent.getName());// 取得父類別名稱
			setEditIsEndNode(category.getIsEndnode());
			setEdittemplateid(String.valueOf(category.getTemplateId()));
			if (StringUtils.isNotEmpty(category.getIsEndnode())) {
				this.menu = menuService.get("Category_LVA_Template");
			}
		}
		editstartdate = new SimpleDateFormat(EcConstant.PATTERN_DATE).format(new java.util.Date());
		return "editdata";
	}

	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public Category getCategory() {
		return category;
	}

	public String getCategoryid() {
		return categoryid;
	}

	public List<Category> getCategoryRoot() {
		return categoryRoot;
	}

	public CategoryService getCategoryService() {
		return categoryService;
	}

	/**
	 * @return the editaliasname
	 */
	public String getEditaliasname() {
		return editaliasname;
	}

	public String getEditenddate() {
		return editenddate;
	}

	public String getEditisbrand() {
		return editisbrand;
	}

	public String getEditIsEndNode() {
		return editIsEndNode;
	}

	/**
	 * @return the editishighlight
	 */
	public String getEditishighlight() {
		return editishighlight;
	}

	/**
	 * @return the editispromotion
	 */
	public String getEditispromotion() {
		return editispromotion;
	}

	public String getEditisvisible() {
		return editisvisible;
	}

	public String getEditlevel() {
		return editlevel;
	}

	public String getEditname() {
		editname = editname.replace('-', '－');
		editname = editname.replace(',', '，');
		return editname;
	}

	public String getEditorgnizationpath() {
		return editorgnizationpath;
	}

	public String getEditpmID() {
		return editpmID;
	}

	public String getEditshowseq() {
		return editshowseq;
	}

	public String getEditstartdate() {
		return editstartdate;
	}

	public String getEdittemplateid() {
		return edittemplateid;
	}

	public String getFlag() {
		return flag;
	}

	public String getId() {
		return id;
	}

	public String getInitlevel() {
		return initlevel;
	}

	public String getJsons() {
		return jsons;
	}

	public Menu getMenu() {
		return menu;
	}

	public String getName() {
		return name;
	}

	public String getNewcategory() {
		return newcategory;
	}

	/**
	 * @return the parentName
	 */
	public String getParentName() {
		return parentName;
	}

	public String getProductCategory() throws CoreException {
		categories = categoryService.getAvailableChild(Long.parseLong(categoryid));
		// for (Category category : categories) {
		// logger.info("category name:{}", category.getName());
		// }
		return "jsonCategories";
	}

	/**
	 * @return the timeend
	 */
	public String getTimeend() {
		return timeend;
	}

	/**
	 * @return the timestart
	 */
	public String getTimestart() {
		return timestart;
	}

	/**
	 * @return the userService
	 */
	public UserService getUserService() {
		return userService;
	}

	public String jsonCheckIsEndnode() {
		if (StringUtils.isNotBlank(endNodeId)) {
			category = categoryService.get(Long.parseLong(endNodeId));
			// if (category.getIsEndnode().equals("N")) {
			List<Category> childCate = categoryService.getChild(category.getId());
			if (childCate.size() > 0) {
				changeEndnodeMsg = "该分类下还有子分类，若将该分类设为最底层，会自动删除其子分类，并将子分类下的商品合并到该分类中。";
			}
			// }
		}
		return "jsonCheckIsEndnode";
	}

	public String savedata() throws ParseException {
		if (StringUtils.isNotEmpty(getEditname())) {
			try {// 修改
				DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				User user = AdminHelper.getUser();
				String oldCateEndCode;
				if (StringUtils.isNotBlank(id) && StringUtils.isBlank(newcategory)) {
					category = categoryService.get(Long.parseLong(id));
					// parent = categoryService.get(category.getParentId());
					oldCateEndCode = category.getIsEndnode();
					// category.setName(getEditname().replace('-', '－'));
					if (AdminHelper.hasPermission("GROSSPROFIT")) {
						if (StringUtils.isNotBlank(getEditGrossProfit())) {
							category.setGrossProfit(new BigDecimal(getEditGrossProfit()).setScale(1));
						} else {
							category.setGrossProfit(null);
						}
					}
					category.setName(getEditname());
					category.setAliasName(getEditaliasname());
					category.setTemplateId(getEdittemplateid());
					category.setShowSeq(Integer.parseInt(getEditshowseq()));
					if (!category.getLevel().equals("1")) {
						category.setIsPromotion(getEditispromotion());
						category.setIsBrand(getEditisbrand());
					} else {
						category.setIsPromotion("N");
						category.setIsBrand("N");
					}
					category.setIsHighlight(getEditishighlight());
					// if (StringUtils.equalsIgnoreCase("N", parent.getIsVisible())) {
					// category.setIsVisible("N");
					// } else {
					category.setIsVisible(getEditisvisible());
					// }
					category.setOrgnizationPath(user.getGroupName());
					category.setStartDate(format.parse(getEditstartdate() + " " + timestart.trim()));
					category.setEndDate(format.parse(getEditenddate() + " " + timeend.trim()));
					category.setPmID(user.getUsername());
					// category.setLevel(getEditlevel());

					if (category.getLevel().equals("1")) {
						if (category.getParentId().toString().equals("11")) {
							category.setIsEndnode("Y");
						} else {
							category.setIsEndnode("N");
						}
					} else if (category.getLevel().equals("5")) {
						category.setIsEndnode("Y");
					} else if (!category.getIsEndnode().equals("Y")) {
						category.setIsEndnode(getEditIsEndNode());
					}

					if ("Y".equals(category.getIsEndnode())) {
						// update bottom level product category
						logger.info("update1");
						category = categoryService.updateCategoryAndProductCategory(category);
					} else {
						logger.info("update2");
						category = categoryService.update(category);
					}
					setJsons("0-" + category.getId() + "-" + category.getName() + "-" + category.getLevel());
				} else {// 新增
					Category parent = categoryService.get(Long.parseLong(getNewcategory()));
					Category category = new Category();
					if (AdminHelper.hasPermission("GROSSPROFIT")) {
						if (StringUtils.isNotBlank(getEditGrossProfit())) {
							category.setGrossProfit(new BigDecimal(getEditGrossProfit()).setScale(1));
						} else {
							category.setGrossProfit(null);
						}
					}
					category.setName(getEditname());
					category.setAliasName(getEditaliasname());
					category.setParentId(Long.parseLong(getNewcategory()));
					category.setStartDate(format.parse(getEditstartdate() + " " + timestart.trim()));
					category.setEndDate(format.parse(getEditenddate() + " " + timeend.trim()));
					category.setPmID(user.getUsername());
					category.setIsHighlight(getEditishighlight());
					// if (StringUtils.equalsIgnoreCase("N", parent.getIsVisible())) {
					// category.setIsVisible("N");
					// } else {
					category.setIsVisible(getEditisvisible());
					// }
					category.setOrgnizationPath(user.getGroupName());
					category.setShowSeq(Integer.parseInt(getEditshowseq()));
					category.setTemplateId(getEdittemplateid());
					category.setLevel(String.valueOf(Integer.parseInt(parent.getLevel()) + 1));

					if (!category.getLevel().equals("1")) {
						category.setIsPromotion(getEditispromotion());
						category.setIsBrand(getEditisbrand());
					} else {
						category.setIsPromotion("N");
						category.setIsBrand("N");
					}
					if (category.getLevel().equals("1")) {
						if (category.getParentId().toString().equals("11")) {
							category.setIsEndnode("Y");
						} else {
							category.setIsEndnode("N");
						}
					} else if (category.getLevel().equals("5")) {
						category.setIsEndnode("Y");
					} else {
						if (categoryService.getChild(parent.getId()).size() == 0) {
							category.setIsEndnode("Y");
							setEditIsEndNode("Y");
						} else {
							category.setIsEndnode(getEditIsEndNode());
						}
					}
					category.setIsDelete("N");
					if (StringUtils.equalsIgnoreCase("Y", category.getIsEndnode())
							&& StringUtils.equalsIgnoreCase("Y", parent.getIsEndnode())) {
						logger.info("save1");
						category = categoryService.updateCategoryAndProductCategory(category);
					} else {
						logger.info("save2");
						category = categoryService.save(category);
					}
					setJsons("1-" + category.getId() + "-" + category.getName() + "-" + category.getLevel());
					// if (initlevel.equals("1")) {
					// category.setCategoryPath(category.getParentId() + "/" + category.getId());
					// } else {
					// Category parent = categoryService.get(category.getParentId());
					// category.setCategoryPath(parent.getCategoryPath() + "/" + category.getId());
					// }
					// category = categoryService.update(category);
				}
			} catch (CoreException e) {
				addActionError(e.getMessage());
				e.printStackTrace();
				setJsons("error");
				return "savedata";
			}
		}
		return "savedata";
	}

	public String searchBox() throws CoreException {
		if (null == categoryRoot) {
			categoryRoot = categoryService.getChild(0l);
		}
		return "searchbox";
	}

	/* 商品選取目錄 */
	public String selectProdcutCategory() throws CoreException {
		StringBuffer sb = new StringBuffer();
		String spc = "";
		if (null == categoryRoot) {
			categoryRoot = categoryService.getChild(0l);
		}
		if (!categoryid.equals("null")) {
			if (getCategoryid() != null && !"null".equals(getCategoryid())) {
				if (!getCategoryid().subSequence(0, 1).equals("x")) {
					sb.append("[");
					List<Category> categories = categoryService.getChild(Long.parseLong(getCategoryid()));
					if (categories.size() > 0) {
						for (Category ctry : categories) {
							sb.append("\"");
							sb.append(ctry.getId() + ":" + ctry.getName());
							sb.append("\"");
							sb.append(",");
						}
						spc = sb.substring(0, sb.length() - 1);// 去掉最後一個逗點
					}
					spc = spc + "]";
					setJsons(spc);
				}
			}
		}
		return "arraydata";
	}

	public String searchRootData() {
		CommonCriteria criteria = new CommonCriteria();
		criteria.addEq("level", "0");
		if (StringUtils.isNotBlank(visibleParam)) {
			criteria.addEq("isVisible", visibleParam.toUpperCase());
		}
		if (StringUtils.isNotBlank(deleteParam)) {
			criteria.addEq("isDelete", deleteParam.toUpperCase());
		}
		categories = categoryService.getList(0, -1, criteria, new String[] { "showSeq asc" });
		logger.info("categories:{}", categories);
		menu = menuService.get("Category_LVA_Template");
		return "listRootData";
	}

	/**
	 * 编辑馆
	 * 
	 * @return
	 */
	public String editRootData() {

		if (StringUtils.isNotBlank(id)) {
			category = categoryService.get(Long.parseLong(id));
			edittemplateid = category.getTemplateId();
			editorgnizationpath = category.getOrgnizationPath();
		}
		return "editRootData";
	}

	public String addRootData() {
		category = null;
		editname = null;
		editaliasname = null;
		editstartdate = new SimpleDateFormat(EcConstant.PATTERN_DATE).format(new Date());
		editenddate = null;
		editisvisible = null;
		editorgnizationpath = null;
		edittemplateid = null;
		return "editRootData";
	}

	/**
	 * 新增馆
	 * 
	 * @return
	 * @throws ParseException
	 */
	public String saveRootData() throws ParseException {
		try {
			DateFormat format = new SimpleDateFormat(EcConstant.PATTERN_TIMESTAMP_HH_MM);
			if (StringUtils.isNotBlank(id)) {
				category = categoryService.get(Long.parseLong(id));
				category.setAliasName(editaliasname);
				// category.setName(editname);
				category.setGrossProfit(new BigDecimal(getEditGrossProfit()).setScale(1));
				category.setName(getEditname());
				category.setStartDate(format.parse(editstartdate + " " + timestart.trim()));
				category.setEndDate(format.parse(editenddate + " " + timeend.trim()));
				category.setIsVisible(editisvisible);
				category.setTemplateId(edittemplateid);
				category.setIsDelete(editisdelete);
				category.setShowSeq(Integer.parseInt(editshowseq));
				category.setOrgnizationPath(editorgnizationpath);
			} else {
				category = new Category();
				category.setGrossProfit(new BigDecimal(getEditGrossProfit()).setScale(1));
				category.setAliasName(editaliasname);
				// category.setName(editname);
				category.setName(getEditname());
				category.setStartDate(format.parse(editstartdate + " " + timestart.trim()));
				category.setEndDate(format.parse(editenddate + " " + timeend.trim()));
				category.setIsVisible(editisvisible);
				category.setTemplateId(edittemplateid);
				category.setOrgnizationPath(editorgnizationpath);
				category.setShowSeq(Integer.parseInt(editshowseq));
				category.setParentId(0l);
				category.setLevel("0");
				category.setIsBrand("N");
				category.setIsEndnode("N");
				category.setIsPromotion("N");
				category.setIsDelete(editisdelete);
			}
			categoryService.save(category);
			addActionMessage("储存成功");
		} catch (Exception e) {
			addActionMessage("储存失败");
		}
		return editRootData();
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public void setCategoryid(String categoryid) {
		this.categoryid = categoryid;
	}

	public void setCategoryRoot(List<Category> categoryRoot) {
		this.categoryRoot = categoryRoot;
	}

	public void setCategoryService(CategoryService categoryService) {
		this.categoryService = categoryService;
	}

	/**
	 * @param editaliasname the editaliasname to set
	 */
	public void setEditaliasname(String editaliasname) {
		this.editaliasname = editaliasname;
	}

	public void setEditenddate(String editenddate) {
		this.editenddate = editenddate;
	}

	public void setEditisbrand(String editisbrand) {
		this.editisbrand = editisbrand;
	}

	public void setEditIsEndNode(String editIsEndNode) {
		this.editIsEndNode = editIsEndNode;
	}

	/**
	 * @param editishighlight the editishighlight to set
	 */
	public void setEditishighlight(String editishighlight) {
		this.editishighlight = editishighlight;
	}

	/**
	 * @param editispromotion the editispromotion to set
	 */
	public void setEditispromotion(String editispromotion) {
		this.editispromotion = editispromotion;
	}

	public void setEditisvisible(String editisvisible) {
		this.editisvisible = editisvisible;
	}

	public void setEditlevel(String editlevel) {
		this.editlevel = editlevel;
	}

	public void setEditname(String editname) {
		this.editname = editname;
		editname = editname.replace('-', '－');
		editname = editname.replace(',', '，');
	}

	public void setEditorgnizationpath(String editorgnizationpath) {
		this.editorgnizationpath = editorgnizationpath;
	}

	public void setEditpmID(String editpmID) {
		this.editpmID = editpmID;
	}

	public void setEditshowseq(String editshowseq) {
		this.editshowseq = editshowseq;
	}

	public void setEditstartdate(String editstartdate) {
		this.editstartdate = editstartdate;
	}

	public void setEdittemplateid(String edittemplateid) {
		this.edittemplateid = edittemplateid;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setInitlevel(String initlevel) {
		this.initlevel = initlevel;
	}

	public void setJsons(String jsons) {
		this.jsons = jsons;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	public void setMenuService(DomainService<Menu> menuService) throws CoreException {
		this.menuService = menuService;
		this.menu = menuService.get("Category_LVA_Template");
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setNewcategory(String newcategory) {
		this.newcategory = newcategory;
	}

	/**
	 * @param parentName the parentName to set
	 */
	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	/**
	 * @param timeend the timeend to set
	 */
	public void setTimeend(String timeend) {
		this.timeend = timeend;
	}

	/**
	 * @param timestart the timestart to set
	 */
	public void setTimestart(String timestart) {
		this.timestart = timestart;
	}

	/**
	 * @param userService the userService to set
	 */
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public String templateList() throws CoreException {
		Map<String, Option> mapTemplete;
		StringBuffer sbTemLst;
		if (getFlag().equals("Y")) {
			mapTemplete = menuService.get("Category_LVC_Template").getOptions();
			sbTemLst = new StringBuffer();
			sbTemLst.append("process({");
			int sum = 0;
			for (Option arrayTemplate : mapTemplete.values()) {
				sbTemLst.append("\"");
				sbTemLst.append(arrayTemplate.getCode() + "\":\"");
				sbTemLst.append(arrayTemplate.getName() + "\"");
				if (sum < mapTemplete.size() - 1) {
					sbTemLst.append(",");
				}
				sum = sum + 1;
			}
			sbTemLst.append("});");
		} else {
			mapTemplete = menuService.get("Category_LVB_Template").getOptions();
			sbTemLst = new StringBuffer();
			sbTemLst.append("process({");
			int sum = 0;
			for (Option arrayTemplate : mapTemplete.values()) {
				sbTemLst.append("\"");
				sbTemLst.append(arrayTemplate.getCode() + "\":\"");
				sbTemLst.append(arrayTemplate.getName() + "\"");
				if (sum < mapTemplete.size() - 1) {
					sbTemLst.append(",");
				}
				sum = sum + 1;
			}
			sbTemLst.append("});");
		}
		setJsons(sbTemLst.toString());
		return "arraydata";
	}

	public String getChangeEndnodeMsg() {
		return changeEndnodeMsg;
	}

	public void setChangeEndnodeMsg(String changeEndnodeMsg) {
		this.changeEndnodeMsg = changeEndnodeMsg;
	}

	public String getEndNodeId() {
		return endNodeId;
	}

	public void setEndNodeId(String endNodeId) {
		this.endNodeId = endNodeId;
	}

	public List<Group> getGroups() {
		return groups;
	}

	public void setGroups(List<Group> groups) {
		this.groups = groups;
	}

	public String getVisibleParam() {
		return visibleParam;
	}

	public String getDeleteParam() {
		return deleteParam;
	}

	public void setVisibleParam(String visibleParam) {
		this.visibleParam = visibleParam;
	}

	public void setDeleteParam(String deleteParam) {
		this.deleteParam = deleteParam;
	}

	public String getEditisdelete() {
		return editisdelete;
	}

	public void setEditisdelete(String editisdelete) {
		this.editisdelete = editisdelete;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.opensymphony.xwork2.Preparable#prepare()
	 */
	@Override
	public void prepare() throws Exception {
		clearErrorsAndMessages();
		// 找出a-20的部門
		groups = groupService.getList(0, -1, new CommonCriteria().addRlike("code", EcConstant.PRODUCT_PM_GROUP_CODE),
				new String[] { "code" });
		for (Group group : groups) {
			groupsMap.put(group.getCode(), group);
		}
	}

	public Map getGroupsMap() {
		return groupsMap;
	}

	public void setGroupsMap(Map groupsMap) {
		this.groupsMap = groupsMap;
	}

	public Category getParent() {
		return parent;
	}

	public void setParent(Category parent) {
		this.parent = parent;
	}

	public String getEditGrossProfit() {
		return editGrossProfit;
	}

	public void setEditGrossProfit(String editGrossProfit) {
		this.editGrossProfit = editGrossProfit;
	}
}
